<?php
$category = get_the_category();//获得当前分类目录名称
if(is_single()){
    $current_category_id=$category[0]->term_id;
}else{
    $current_category_id=$category[0]->cat_ID;
}
// var_dump($current_category_id);
?>
<div class="slider_part">
	<h5 class="slider_part_title">推荐文章</h5>
	<ul>
		<?
		$sticky = get_option( 'sticky_posts' );
			$args=array(
				// 'cat' => 30,   // 分类ID
				'posts_per_page' =>5, // 显示篇数
                // 'cat'=>$current_category_id,
				'category__in'=>$current_category_id,
				'orderby'=>'date',//按发布时间
				'order' => 'desc',
				'suppress_filters' => true,
				'ignore_sticky_posts' => 1,//忽略sticky_posts，不置顶，但是输出置顶文章
				'post__not_in' => $sticky,//排除置顶文章，
			);
			$query = new WP_Query( $args );
			if($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
			
		?>
		<li>
			<a class="shenglue" href="<?php the_permalink(); ?>" target="_blank">

				<?php echo  get_the_title(); ?>
				
			</a>
		</li>
		<?php  endwhile; endif; wp_reset_postdata();?>  
	</ul>
</div>
<div class="slider_part">
	<h5 class="slider_part_title">最新文章</h5>
	<ul>
		<?php
		wp_reset_query();
		wp_reset_postdata();
		

$args2=array(
 
    'posts_per_page' => 5, // 显示篇数
    'orderby'=>'date',
	'order' => 'DESC',
	'limit' =>5,
	'category__not_in'=>$current_category_id,
	'ignore_sticky_posts' => 1,//忽略sticky_posts，不置顶，但是输出置顶文章
	'post__not_in' => $sticky,//排除置顶文章，不输出
);



			// $args2=array(
			// 	// 'cat' => -30,   // 分类ID
			// 	'posts_per_page' =>2, // 显示篇数
			// 	// 'category__not_in'=>$current_category_id,
			// 	'orderby'=>'date',//按修改时间
			// 	'order' => 'desc',
			// 	// 'suppress_filters' => true
                
			// );
			// $query = new WP_Query( $args2 );
			query_posts($args2);


			if(have_posts()) : while (have_posts()) : the_post();
		?>
		<li>
			<a class="shenglue" href="<?php the_permalink(); ?>" target="_blank">


				<?php echo get_the_title(); ?>
				
				
			</a>
		</li>
		<?php  endwhile; endif; wp_reset_query();?>  
	</ul>
</div>

